home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CoolWB / Icons / Other / Laceless / Install_Icons < prev    next >
Text File  |  1997-06-03  |  10KB  |  275 lines

  1. ; Laceless Icon set installer script
  2. ;
  3. ; $VER: Laceless Icons Installer 1.1 (14.01.97)
  4. ;
  5. ; Will install icons and back up old ones, or retrieve backed up old icons
  6. ; and disgard Laceless icons.
  7. ;
  8. ; Author : Gavin Dodds
  9. ;
  10. ; V1.0 : 27/11/96 : First release
  11. ;
  12. ; V1.1 : 14/1/97  : Slight update : Check for assign is now done only once
  13.  
  14. (set old_level @user-level)
  15.  
  16. (user 2)
  17.  
  18. (set name         "Laceless"
  19.      vers         "V1.1"
  20.      utname       "ic"
  21.      assig        (cat name ":")
  22.      backdir      (tackon "Sys:Storage/Icons" (cat "Pre_" name) )
  23.      sdir         (tackon (if (= 1 (exists @icon) )
  24.                             (pathonly (expandpath @icon) )
  25.                             (expandpath @icon)
  26.                           ) "Icons"
  27.                   )
  28.     ddir          "Sys:"
  29.     @default-dest ddir
  30.     onoroff       (askbool (prompt "\n\nDo you want to install or remove "
  31.                                    "the " name " icon set?")
  32.                            (choices "Install" "Remove")
  33.                            (help "Install or Remove?  It's not hard is it?")
  34.                   )
  35.     oldver        (if(exists "Env:LACELESS")
  36.                       (getenv "LACELESS")
  37.                       ("0.0")
  38.                   )
  39.     delstore      0
  40.     savdir        "NONE"
  41.     hasic         (run "which iconpos")
  42.     hasassig      (exists assig (noreq) )
  43. )
  44.  
  45. (user old_level)
  46.  
  47. (if (= onoroff 1)
  48.   ( (if hasic
  49.       ( (user 2)
  50.         (set decis (askbool (prompt "\nYou do not appear to have the "
  51.                                     "IconPos command on your system.\n\n"
  52.                                     "This script uses IconPos to copy "
  53.                                     "icon images, without disrupting the "
  54.                                     "position of your icons or the sizes "
  55.                                     "of your drawers.\n\n"
  56.                                     "Without IconPos the script will use "
  57.                                     "copy and your icons' extra information "
  58.                                     "will become lost.\n\n"
  59.                                     "Do you want to continue with the "
  60.                                     "installation procedure?"
  61.                             )
  62.                             (Choices "Yes Continue" "No Abort")
  63.                             (help "You can abort now and try and find "
  64.                                   "IconPos, then attemp the installation "
  65.                                   "again.  IconPos is usually found in the "
  66.                                   "C drawer of the Install3.0 disk."
  67.                             )
  68.                    )
  69.         )
  70.         (if (NOT decis)
  71.           (abort "\n\nIf you are looking for the IconPos utility, remember "
  72.                  "it is usually found in the C drawer of your Workbench "
  73.                  "install disk."
  74.           )
  75.         )
  76.         (user old_level)
  77.       )
  78.     )
  79.     (message "This script will install the " name " " vers " icon set onto "
  80.              "your system.\n"
  81.              "Your existing icons will be backed up into " backdir
  82.              " first.\n\n"
  83.              "This directory will be created if it doesn't already exist.\n"
  84.     )
  85.     (if (NOT hasassig )
  86.       ( (user 2)
  87.         (if (askbool (prompt "Would you like the " name " icon set "
  88.                              "installed for easy access?\n\n"
  89.                              "An assign will be added to "
  90.                              "your user-startup file to allow the " utname
  91.                              " utility to find the icons."
  92.                      )
  93.                      (choices "Yes" "No")
  94.                      (help "If you choose yes, you will be asked to suppy "
  95.                            "a directory for the " name " icons to be stored "
  96.                            "in.\n\n"
  97.                            "The icons can then be located using an assign "
  98.                            "which will be added to your user-startup file."
  99.                      )
  100.             )
  101.           (set savdir (tackon
  102.                         (askdir (prompt "Please choose a drawer to install "
  103.                                         "the " name " icon set into."
  104.                                 )
  105.                                 (default sdir)
  106.                                 (help "Come on it's not that hard is it?\n\n"
  107.                                       "A drawer called " name " will be "
  108.                                       "created in your chosen drawer."
  109.                                 )
  110.                         ) name
  111.                       )
  112.           )
  113.         ) ;if askbool
  114.         (user old_level)
  115.       )
  116.       (set savdir assig) ;if old installation exists, update it
  117.     ) ;if execute
  118.     (set @default-dest savdir)
  119.   )
  120.   ( (message "This script will remove the " name " " oldver " icon set from "
  121.              "your system.\n"
  122.              "Your old icons will be retrieved up from " backdir ".\n\n"
  123.              "This directory will then be deleted.\n"
  124.     )
  125.     (if ( hasassig )
  126.       ( (user 2)
  127.         (set delstore (askbool (prompt "Would you like the " name " icon "
  128.                                        "set removed from your " 
  129.                                        (expandpath assig) " drawer?"
  130.                                )
  131.                                (choices "Yes" "No")
  132.                                (help "If you choose \"Yes\" the directory "
  133.                                      (expandpath assig) " will be deleted."
  134.                                )
  135.                       )
  136.         )
  137.         (user old_level)
  138.       )
  139.     )
  140.   )
  141. )
  142.  
  143. (if (NOT (exists backdir) )
  144.   (if (= onoroff 1)
  145.     ( (complete 0)
  146.       (makedir (pathonly (pathonly backdir) ) (infos) )
  147.       (makedir (pathonly backdir) (infos) )
  148.       (makedir backdir (infos) )
  149.       (complete 2)
  150.     )
  151.     (abort "The backup directory " backdir " does not exist.  Either you "
  152.            "have not installed the " name " icon set or you have deleted "
  153.            "your old icon backups.\nEither way, this script can't continue."
  154.     )
  155.   )
  156. )
  157.  
  158. (if (= onoroff 1)
  159.   (working "Installing " name " Icons")
  160.   (working "Removing " name " Icons")
  161. )
  162.  
  163. (set n 0)
  164. (while (set dirname (select n "Prefs"
  165.                               "Prefs/Presets"
  166.                               "System"
  167.                               "Wbstartup"
  168.                               "Devs"
  169.                               "Devs/Datatypes"
  170.                               "Devs/Printers"
  171.                               "Devs/Keymaps"
  172.                               "Devs/Monitors"
  173.                               "Devs/DosDrivers"
  174.                               "Storage"
  175.                               "Storage/Datatypes"
  176.                               "Storage/Printers"
  177.                               "Storage/Keymaps"
  178.                               "Storage/Monitors"
  179.                               "Storage/DosDrivers"
  180.                               "Expansion"
  181.                               "Tools"
  182.                               "Tools/Commodities"
  183.                               "Utilities"
  184.                               ""
  185.                     )
  186.        )
  187.   (set iconame (cat dirname ".info" ) )
  188.   (set destname (pathonly (tackon backdir dirname) ) )
  189.   (if (= onoroff 1)
  190.     ( (if (NOT (exists destname) )
  191.         (makedir destname )
  192.       )
  193.       (if (NOT (exists (tackon backdir iconame) ) )
  194.         ( (copyfiles (source (tackon ddir iconame) )
  195.                    (dest destname)
  196.           )
  197.         )
  198.       )
  199.       (if (NOT hasic)
  200.         (run (cat "iconpos " (tackon ddir iconame)
  201.                   " IMAGE " (tackon sdir dirname)
  202.              )
  203.         )
  204.         (copyfiles (source (tackon sdir iconame) )
  205.                    (dest (pathonly (tackon ddir dirname) ) )
  206.         )
  207.       )
  208.     )
  209.     (copyfiles (source (tackon backdir iconame) )
  210.                (dest (pathonly (tackon ddir dirname) ) )
  211.     )
  212.   )
  213.   (complete (+ (* n 4) 13) )
  214.   (set n (+ n 1) )
  215. )
  216.  
  217. (if (= onoroff 1)
  218.   (if (NOT (= savdir "NONE") )
  219.     ( (copyfiles (source (pathonly sdir) ) (dest savdir) (all) )
  220.       (copyfiles (source (cat (pathonly sdir) ".info") )
  221.                  (dest (pathonly (expandpath savdir ) ) )
  222.       )
  223.       (if (NOT (exists assig (noreq) ) )
  224.         ( (makeassign name savdir)
  225.           (startup name
  226.             (prompt "Adding assign to s:user-startup")
  227.             (help "This will add the correct assign to your s:user-startup "
  228.                   "file, so that the " utname " utility can find the icons."
  229.             )
  230.             ( (command (cat "assign " assig " " savdir ) )
  231.             )
  232.           )
  233.         )
  234.       )
  235.     )
  236.   )
  237.   ( (message "\n\nDeleting the " backdir " directory.")
  238.     (run (cat "delete " backdir " ALL") )
  239.     (delete (cat backdir ".info") )
  240.     (if (= delstore 1)
  241.       ( (message "\n\nDeleting the " (expandpath assig) " directory.")
  242.         (set deldir (expandpath assig) )
  243.         (run "assign " assig " REMOVE")
  244.         (if (exists assig (noreq) )
  245.           (message "Assign removal didn't work!")
  246.         )
  247.         (run (cat "delete " deldir " ALL") )
  248.         (delete (cat deldir ".info" ) )
  249.         (message "\n\nYour " deldir " directory has been "
  250.                  "deleted.\n"
  251.                  "You will have to remove the " assig " assign from your "
  252.                  "S:user-startup file yourself."
  253.         )
  254.       )
  255.     )
  256.   )
  257. )
  258.  
  259. (complete 100)
  260.  
  261. (delete "Envarc:LACELESS")
  262. (delete "Env:LACELESS")
  263.  
  264. (if (= onoroff 1)
  265.   ( (textfile (dest "Envarc:LACELESS") (append vers ) )
  266.     (textfile (dest "Env:LACELESS") (append vers) )
  267.     (exit "The " name " Icon set can be removed and your old icons restored "
  268.           "with this script."
  269.     )
  270.   )
  271.   (exit "The " name " Icon set can be reinstalled and your old icons backed "
  272.         "up with this script."
  273.   )
  274. )
  275.